﻿import com.customine.api.ICustomDesign;
/**
 * @author colin
 * this class provide the available color, gender, size and style to make a Custom Tshirt.
 */
class com.customine.design.TShirtBase implements ICustomDesign{
	private var designFormat:String="color=1,2&gender=1,2&size=1,2,3,4,5&style=1,2";
	private var swf:String;

	public var availableColor:Array;
	public var availableGender:Array;
	public var availableSize:Array;
	public var availableStyle:Array;

	public function TShirtBase(availableColor:Array,availableGender:Array,availableSize:Array,availableStyle:Array,swf:String){
		this.availableColor = availableColor;
		this.availableGender = availableGender;
		this.availableSize = availableSize;
		this.availableStyle = availableStyle;
		this.swf = swf;
	}
	
	public function view(design : String) {
		var src:Array = design.split('&');
		this.availableColor = src[0].split("=")[1].split(',');
		this.availableGender = src[1].split("=")[1].split(',');
		this.availableSize = src[2].split("=")[1].split(',');
		this.availableStyle = src[3].split("=")[1].split(',');
	}

	public function save() : String {
		var ret:String = "";
		ret = ret+'color='+this.availableColor.join(',');
		ret = ret+'&gender='+this.availableColor.join(',');
		ret = ret+'&size='+this.availableColor.join(',');
		ret = ret+'&style='+this.availableColor.join(',');
		return ret;
	}
	
	public function getPath() : String {
		return swf;
	}

	public function setPath(url : String) {
		swf = url;
	}
}